##########################################################################################################
# REPLICATION CODE FOR                                                                                   #
# "Conspiracy beliefs and perceptions of electoral integrity: Cross-national evidence from 29 countries" #
# PUBLIC OPINION QUARTERLY																										                           #
#																																                                         #
# AUTHOR: Christian Schnaudt (corresponding author)                                                      #
# ADDRESS: School of Social Sciences, University of Mannheim, 68131 Mannheim, Germany                    # 
# E-MAIL: schnaudt@uni-mannheim.de 																								                       #
# ORCID: 0000-0002-2062-7770																									                           #   
#																																                                         #
# VERSION DATE: 2023-10-06							                                                                 #   
##########################################################################################################


# REPLICATION CODE FOR CREATING TABLES S4-S16 (SEE SUPPLEMENTARY MATERIAL)

# IMPORTANT: RUN THE BELOW CODE ONLY AFTER RUNNING the FILE "analysis_models.R"
# (and using the R workspace created by "analysis_models.R")


################################################################################

#TABLE S4: models for main analysis presented in article (with standard errors replaced by exact p-values)

texreg::htmlreg(list(model1, model2, model3, model6, model8),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3",
                                        "Model 4",
                                        "Model 5"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=TRUE,
                include.loglik = FALSE,
                override.se=list(summary(model1)$coef[,5],
                                 summary(model2)$coef[,5],
                                 summary(model3)$coef[,5],
                                 summary(model6)$coef[,5],
                                 summary(model8)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Electoral integrity (country)",
                                      "Conspiracy beliefs (ind.) X Electoral integrity (country)"
                ), 
                file = "tableS4.doc")




################################################################################

#TABLE S5: models using single conspiracy item on "secret group"

summary(model8a_fac)

texreg::htmlreg(list(model1, model2a_fac, model3a_fac, model6a_fac, model8a_fac),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3",
                                        "Model 4",
                                        "Model 5"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=TRUE,
                include.loglik = FALSE,
                override.se=list(summary(model1)$coef[,5],
                                 summary(model2a_fac)$coef[,5],
                                 summary(model3a_fac)$coef[,5],
                                 summary(model6a_fac)$coef[,5],
                                 summary(model8a_fac)$coef[,5]
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy: disagree (vs. strongly disagree)",
                                      "Conspiracy: neither (vs. strongly disagree)",
                                      "Conspiracy: agree (vs. strongly disagree)",
                                      "Conspiracy: strongly agree (vs. strongly disagree)",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Electoral integrity (country)",
                                      "Conspiracy: disagree (vs. strongly disagree) X Electoral integrity (country)",
                                      "Conspiracy: neither (vs. strongly disagree) X Electoral integrity (country)",
                                      "Conspiracy: agree (vs. strongly disagree) X Electoral integrity (country)",
                                      "Conspiracy: strongly agree (vs. strongly disagree) X Electoral integrity (country)"
                ), 
                file = "tableS5.doc")




################################################################################

#TABLE S6: models using single conspiracy item on "scientists"

summary(model8b_fac)

texreg::htmlreg(list(model1, model2b_fac, model3b_fac, model6b_fac, model8b_fac),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3",
                                        "Model 4",
                                        "Model 5"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=TRUE,
                include.loglik = FALSE,
                override.se=list(summary(model1)$coef[,5],
                                 summary(model2b_fac)$coef[,5],
                                 summary(model3b_fac)$coef[,5],
                                 summary(model6b_fac)$coef[,5],
                                 summary(model8b_fac)$coef[,5]
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy: disagree (vs. strongly disagree)",
                                      "Conspiracy: neither (vs. strongly disagree)",
                                      "Conspiracy: agree (vs. strongly disagree)",
                                      "Conspiracy: strongly agree (vs. strongly disagree)",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Electoral integrity (country)",
                                      "Conspiracy: disagree (vs. strongly disagree) X Electoral integrity (country)",
                                      "Conspiracy: neither (vs. strongly disagree) X Electoral integrity (country)",
                                      "Conspiracy: agree (vs. strongly disagree) X Electoral integrity (country)",
                                      "Conspiracy: strongly agree (vs. strongly disagree) X Electoral integrity (country)"
                ), 
                file = "tableS6.doc")


################################################################################


#TABLE S7: v2elembaut_nm                
summary(model6r3)

texreg::htmlreg(list(model6r3, model7r3, model8r3),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r3)$coef[,5],
                                 summary(model7r3)$coef[,5],
                                 summary(model8r3)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "EMB autonomy (country)",
                                      "Conspiracy beliefs (ind.) X EMB autonomy (country)"
                                      
                ), 
                file = "tableS7.doc")




################################################################################


#TABLE S8: v2elembcap_nm                 
summary(model6r4)

texreg::htmlreg(list(model6r4, model7r4, model8r4),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r4)$coef[,5],
                                 summary(model7r4)$coef[,5],
                                 summary(model8r4)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "EMB capacity (country)",
                                      "Conspiracy beliefs (ind.) X EMB capacity (country)"
                                      
                ), 
                file = "tableS8.doc")



################################################################################


#TABLE S9: v2elrgstry_nm                                 
summary(model6r5)

texreg::htmlreg(list(model6r5, model7r5, model8r5),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r5)$coef[,5],
                                 summary(model7r5)$coef[,5],
                                 summary(model8r5)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Accuracy voter registry (country)",
                                      "Conspiracy beliefs (ind.) X Accuracy voter registry (country)"
                                      
                ), 
                file = "tableS9.doc")


################################################################################


#TABLE S10: v2elvotbuy_nm                                                 
summary(model6r6)

texreg::htmlreg(list(model6r6, model7r6, model8r6),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r6)$coef[,5],
                                 summary(model7r6)$coef[,5],
                                 summary(model8r6)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Vote buying (country)",
                                      "Conspiracy beliefs (ind.) X Vote buying (country)"
                                      
                ), 
                file = "tableS10.doc")


################################################################################


#TABLE S11: v2elirreg_nm                                                                  
summary(model6r7)

texreg::htmlreg(list(model6r7, model7r7, model8r7),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r7)$coef[,5],
                                 summary(model7r7)$coef[,5],
                                 summary(model8r7)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Voting irregularities (country)",
                                      "Conspiracy beliefs (ind.) X Voting irregularities (country)"
                                      
                ), 
                file = "tableS11.doc")


################################################################################


#TABLE S12: v2elintim_nm                                                                                   
summary(model6r8)

texreg::htmlreg(list(model6r8, model7r8, model8r8),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r8)$coef[,5],
                                 summary(model7r8)$coef[,5],
                                 summary(model8r8)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Election gov. intimidation (country)",
                                      "Conspiracy beliefs (ind.) X Election gov. intimidation (country)"
                                      
                ), 
                file = "tableS12.doc")




################################################################################


#TABLE S13: v2elpeace_nm   

summary(model6r9)

texreg::htmlreg(list(model6r9, model7r9, model8r9),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r9)$coef[,5],
                                 summary(model7r9)$coef[,5],
                                 summary(model8r9)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Non-state electoral violence (country)",
                                      "Conspiracy beliefs (ind.) X Non-state electoral violence (country)"
                                      
                ), 
                file = "tableS13.doc")




################################################################################

#TABLE S14: v2elpeace_nm        

summary(model6r10)

texreg::htmlreg(list(model6r10, model7r10, model8r10),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r10)$coef[,5],
                                 summary(model7r10)$coef[,5],
                                 summary(model8r10)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Elections free and fair (country)",
                                      "Conspiracy beliefs (ind.) X Elections free and fair (country)"
                                      
                ), 
                file = "tableS14.doc")

################################################################################

# TABLE S15: NELDA

summary(model8r2)

texreg::htmlreg(list(model6r2, model7r2, model8r2),
                custom.model.names =  c("Model 1",
                                        "Model 2",
                                        "Model 3"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=T,
                include.loglik = FALSE,
                override.se=list(summary(model6r2)$coef[,5],
                                 summary(model7r2)$coef[,5],
                                 summary(model8r2)$coef[,5]
                ),
                custom.gof.names = c("AIC", "BIC", 
                                     "N (individuals)", "N (countries)",
                                     "Var (countries)", 
                                     "Var (individuals)", 
                                     "Var (conspiracy beliefs)",
                                     "Cov (countries/conspiracy beliefs)"
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Electoral integrity (NELDA, country)",
                                      "Conspiracy beliefs (ind.) X Electoral integrity (NELDA, country)"
                                      
                ), 
                file = "tableS15.doc")

################################################################################


#TABLE S16: model with individual-level interaction between conspiracy beliefs and status as winner/loser

summary(model9)

texreg::htmlreg(list(model9),
                custom.model.names =  c("Model 1"
                ),
                digits = 3,
                dcolumn=TRUE, stars=numeric(0),
                single.row=TRUE,
                include.loglik = FALSE,
                override.se=list(summary(model9)$coef[,5]
                ),
                custom.coef.names = c("Intercept",
                                      "Conspiracy beliefs",
                                      "Distrust in politics",
                                      "Satisfaction w/ economy",
                                      "Political interest",
                                      "Internal efficacy",
                                      "L-R placement",
                                      "Party ID",
                                      "Electoral winner (vs. loser)",
                                      "Non-voter (vs. loser)",
                                      "Voter w/o status (vs. loser)",
                                      "Ineligibles (vs. loser)",
                                      "Media use",
                                      "Age", "Sex: Female", "Education: years",
                                      "Survey mode: Video (vs. F2F)",
                                      "Survey mode: Web (vs. F2F)",
                                      "Survey mode: Paper (vs. F2F)",
                                      "GDP per capita (country)",
                                      "Compulsory voting (country)",
                                      "Electoral integrity (country)",
                                      "Conspiracy beliefs X Electoral winner (vs. loser)",
                                      "Conspiracy beliefs X Non-voter (vs. loser)",
                                      "Conspiracy beliefs X Voter w/o status (vs. loser)",
                                      "Conspiracy beliefs X Ineligibles (vs. loser)"
                ), 
                file = "tableS16.doc")



####################################################################################################